﻿using IntoStationSystem.Db;
using IntoStationSystem.Global;
using Prism.Mvvm;

namespace IntoStationSystem.Models
{
    public class HomeModel : BindableBase
    {
        public HomeModel()
        {
            //DbHelper.Log("HomeModel");
        }
        #region 从PLC读取的数据
        private ushort pageIDFeedback;
        /// <summary>
        /// 页面编号反馈
        /// </summary>
        public ushort PageIDFeedback
        {
            get => pageIDFeedback; set => SetProperty(ref pageIDFeedback, value);
        }

        private ushort produceModel;
        /// <summary>
        /// 生产型号
        /// </summary>
        public ushort ProduceModel
        {
            get => produceModel; set => SetProperty(ref produceModel, value);
        }

        private int produceCount;
        /// <summary>
        /// 生产数量
        /// </summary>
        public int ProduceCount
        {
            get => produceCount; set => SetProperty(ref produceCount, value);
        }

        private int okCount;
        /// <summary>
        /// OK数量
        /// </summary>
        public int OKCount
        {
            get => okCount; set => SetProperty(ref okCount, value);
        }

        private int ngCount;
        /// <summary>
        /// NG数量
        /// </summary>
        public int NGCount
        {
            get => ngCount; set => SetProperty(ref ngCount, value);
        }

        private int beatTime;
        /// <summary>
        /// 节拍时间
        /// </summary>
        public int BeatTime
        {
            get => beatTime; set => SetProperty(ref beatTime, value);
        }


        private int quality;
        /// <summary>
        /// 生产质量
        /// </summary>
        public int Quality
        {
            get => quality; set => SetProperty(ref quality, value);
        }

        private int runTime;
        /// <summary>
        /// 订单运行时间
        /// </summary>
        public int RunTime
        {
            get => runTime; set => SetProperty(ref runTime, value);
        }

        private string craftId;
        /// <summary>
        /// 工艺ID：产品身份ID
        /// </summary>
        public string CraftId
        {
            get => craftId; set => SetProperty(ref craftId, value);
        }

        private bool sysOk;
        /// <summary>
        /// 系统准备OK
        /// </summary>
        public bool SysOK
        {
            get => sysOk; set => SetProperty(ref sysOk, value);
        }

        private bool debugMode;
        /// <summary>
        /// 调试模式
        /// </summary>
        public bool DebugMode
        {
            get => debugMode; set => SetProperty(ref debugMode, value);
        }

        private bool autoMode;
        /// <summary>
        /// 自动模式
        /// </summary>
        public bool AutoMode
        {
            get => autoMode; set => SetProperty(ref autoMode, value);
        }

        private bool pauseMode;
        /// <summary>
        /// 暂停模式
        /// </summary>
        public bool PauseMode
        {
            get => pauseMode; set => SetProperty(ref pauseMode, value);
        }

        private bool stopMode;
        /// <summary>
        /// 停止模式
        /// </summary>
        public bool StopMode
        {
            get => stopMode; set => SetProperty(ref stopMode, value);
        }

        private bool rstMode;
        /// <summary>
        /// 复位模式
        /// </summary>
        public bool RstMode
        {
            get => rstMode; set => SetProperty(ref rstMode, value);
        }

        private bool homeMode;
        /// <summary>
        /// 回原模式
        /// </summary>
        public bool HomeMode
        {
            get => homeMode; set => SetProperty(ref homeMode, value);
        }

        private bool eStopMode;
        /// <summary>
        /// 急停模式
        /// </summary>
        public bool EStopMode
        {
            get => eStopMode; set => SetProperty(ref eStopMode, value);
        }


        private bool forcengMode;
        /// <summary>
        /// 强制NG
        /// </summary>
        public bool ForceNGMode
        {
            get => forcengMode; set => SetProperty(ref forcengMode, value);
        }

        private bool emptyTrayMode;
        /// <summary>
        /// 空托盘模式
        /// </summary>
        public bool EmptyTrayMode
        {
            get => emptyTrayMode; set => SetProperty(ref emptyTrayMode, value);
        }

        private bool mute;
        /// <summary>
        /// 空托盘模式
        /// </summary>
        public bool Mute
        {
            get => mute; set => SetProperty(ref mute, value);
        }
        



        private bool localRemote;
        /// <summary>
        /// 本地/远程
        /// </summary>
        public bool LocalRemote
        {
            get => localRemote; set => SetProperty(ref localRemote, value);
        }

        private bool sysSafe;
        /// <summary>
        /// 系统安全
        /// </summary>
        public bool SysSafe
        {
            get => sysSafe; set => SetProperty(ref sysSafe, value);
        }

        private bool homePos;
        /// <summary>
        /// 初始位置
        /// </summary>
        public bool HomePos
        {
            get => homePos; set => SetProperty(ref homePos, value);
        }

        private bool autoEnd;
        /// <summary>
        /// 自动完成
        /// </summary>
        public bool AutoEnd
        {
            get => autoEnd; set => SetProperty(ref autoEnd, value);
        }

        private bool hasTip;
        /// <summary>
        /// 有提示信息
        /// </summary>
        public bool HasTip
        {
            get => hasTip; set => SetProperty(ref hasTip, value);
        }

        private bool hasWarning;
        /// <summary>
        /// 有警告信息
        /// </summary>
        public bool HasWarning
        {
            get => hasWarning; set => SetProperty(ref hasWarning, value);
        }

        private bool hasAlarm;
        /// <summary>
        /// 有报警信息
        /// </summary>
        public bool HasAlarm
        {
            get => hasAlarm; set => SetProperty(ref hasAlarm, value);
        }

        private int step;
        /// <summary>
        /// 当前工步号
        /// </summary>
        public int Step
        {
            get => step; set => SetProperty(ref step, value);
        }

        private string currentModel;
        /// <summary>
        /// 当前生产型号
        /// </summary>
        public string CurrentModel
        {
            get => currentModel; set => SetProperty(ref currentModel, value);
        }

        
        /// <summary>
        /// 提示信息信号
        /// </summary>
        public bool[] Tips { get; set; } = new bool[Fields.TipsCount];
        /// <summary>
        /// 警告信息信号
        /// </summary>
        public bool[] Warnings { get; set; } = new bool[Fields.WarningsCount];
        /// <summary>
        /// 报警信息信号
        /// </summary>
        public bool[] Alarms { get; set; } = new bool[Fields.AlarmsCount];
        #endregion

    }
}
